package indi.kider.server.applandlord.service.related;

import indi.kider.common.model.employee.TenantQuery;
import indi.kider.common.model.employee.TenantQueryResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
import pers.vankid.common.model.base.CommonResponse;
import pers.vankid.common.utils.page.PageRequest;
import pers.vankid.common.utils.page.PageResponse;

import java.util.List;

/**
 * Created by shixj on 2018/5/25.
 */
@FeignClient(value = "human-resources")
public interface HumanResources {
    /**
     * @api {DELETE} /{id}
     * @apiGroup tenant
     * @apiDescription 删除租客
     * @apiParamExample 请求样例：
     * http://localhost:9002/human-resources/tenant/1
     * @apiSuccessExample {json} 返回样例:
     * {"status":"204","msg":"删除成功！","data":""}}
     */
    @DeleteMapping("tenant/{id}")
    CommonResponse delById(@PathVariable(value = "id") Long id);
    /**
     * @api {PUT} main/{tenantId}
     * @apiGroup tenant
     * @apiDescription 设置主要承租人
     * @apiParamExample 请求样例：
     * http://localhost:9002/human-resources/tenant/main/{tenantId}
     * @apiSuccessExample {json} 返回样例:
     * {"status":"202","msg":"保存成功！","data":""}
     */
    @PutMapping("tenant/main/{tenantId}")
    CommonResponse<String> setMainTenant(@PathVariable(value = "tenantId") Long tenantId);

    /**
     * @api {POST} rent/list
     * @apiGroup tenant
     * @apiDescription 根据租房信息查询租客列表（分页）
     * @apiParamExample 请求样例：
     * http://localhost:9002/human-resources/tenant/rent/list
     * {"num":"0","size":"8","query":{"rentId":"223","name":"shixj2","cardId":12212,"phone":"1221","rentDateStart":"2018-05-15","rentDateEnd":"2018-05-15","expireDateStart":"2018-05-15","expireDateEnd":"2018-05-15"}}
     * @apiSuccessExample {json} 返回样例:
     * {"status":"200","msg":"查询成功！","data":{"rows":[{"rentDate":"2018-05-15","expireDate":"2018-05-15","id":76,"name":"shixj1","cardId":"12212","phone":"1221","title":null,"nationality":"32","professional":"23","wxopenId":null,"state":1,"type":2,"friendsSize":null,"mainId":69}],"total":1,"size":0}}
     */
    @PostMapping("tenant/rent/list")
    CommonResponse<PageResponse<List<TenantQueryResponse>>> getTenantList(@RequestBody PageRequest<TenantQuery> request);
}
